#!/usr/bin/env python
#coding=utf-8

from codingabc.database import db
from app.models.MyModel import MyModelService

class SysRegion(db.Model, MyModelService):
    __bind_key__ = 'huiwang'
    __tablename__ = 'sys_region'

    region_id = db.Column(db.Integer, primary_key=True)
    parent_id = db.Column(db.Integer, default=0)
    region_name = db.Column(db.String(120), default='')
    region_type = db.Column(db.Integer, default=2)
    agency_id = db.Column(db.Integer, default=0)

    def __str__(self):
        return "SysRegion => { \
region_id:%d, parent_id:%d, region_name:'%s', region_type:%d, agency_id:%d}" % (
self.region_id, self.parent_id, self.region_name, self.region_type, self.agency_id)

    __repr__ = __str__


class SysSetting(db.Model, MyModelService):
    __bind_key__ = 'huiwang'
    __tablename__ = 'sys_setting'

    ss_id = db.Column(db.Integer, primary_key=True)
    key = db.Column(db.String(191), default='')
    value = db.Column(db.String(225), default='')
    desc = db.Column(db.String(225), default='')

    def __str__(self):
        return "SysSetting => { \
ss_id:%d, key:'%s', value:'%s', desc:'%s'}" % (
self.ss_id, self.key, self.value, self.desc)

    __repr__ = __str__


class SysMessage(db.Model, MyModelService):
    __bind_key__ = 'huiwang'
    __tablename__ = 'sys_message'

    sm_id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(50), default='0')
    content = db.Column(db.Text, default='')
    add_time = db.Column(db.Integer, default=0)
    update_time = db.Column(db.Integer, default=0)

    def __str__(self):
        return "SysMessage => { \
sm_id:%d, title:'%s', content:'%s', add_time:%d, update_time:%d}" % (
self.sm_id, self.title, self.content, self.add_time, self.update_time)

    __repr__ = __str__
